package com.cxhc.app.api;

import com.cxhc.common.annotation.Anonymous;
import com.cxhc.common.core.domain.R;
import com.cxhc.system.domain.SysNotice;
import com.cxhc.system.service.ISysNoticeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * 获取消息通知
 */
@RestController
@RequestMapping("/api/notice")
@CrossOrigin(origins = "*", maxAge = 3600)
public class ApiNotice {

    @Resource
    private ISysNoticeService noticeService;

    /**
     * 获取通知公告列表
     *
     * @return
     */
    @Anonymous
    @RequestMapping("/list")
    public R<List<SysNotice>> list() {
        return R.ok(noticeService.selectNoticeList(new SysNotice().setStatus("0")));
    }

    @Anonymous
    @RequestMapping("/info/{id}")
    public R<SysNotice> info(@PathVariable Long id) {
        return R.ok(noticeService.selectNoticeById(id));
    }
}
